package com.yoomiito.app.ui.songduoduo.freegoods

import cn.droidlover.xdroidmvp.net.ApiException
import cn.droidlover.xdroidmvp.net.ApiSubscriber
import cn.droidlover.xdroidmvp.net.XApi
import com.yoomiito.app.base.AppConfig
import com.yoomiito.app.base.BaseActPresenter
import com.yoomiito.app.model.bean.GoodsInfo
import com.yoomiito.app.net.YmApi

class StatusOfFreeGoodsPresenter(appConfig: AppConfig) :BaseActPresenter<StatusOfFreeGoodsActivity>(appConfig){

    fun data(){
        YmApi.getYmService()
                .sddRecommendList()
                .compose(v.bindToLifecycle())
                .compose(XApi.getApiTransformerData())
                .compose(XApi.getScheduler())
                .subscribe(object :ApiSubscriber<List<GoodsInfo>>(){
                    override fun onSuccess(t: List<GoodsInfo>?) {
                        v.list(t!!)
                    }

                    override fun onFail(error: ApiException?) {
                        v.dismissLoading()
                    }
                })
    }
}